/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.ExtraStructuredActivities;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.StructuredActivities.ExecutableNode;
import edu.pku.sei.modeler.model.uml.BasicActivities.ObjectNode;
import edu.pku.sei.modeler.model.uml.Kernel.Classifier;

import edu.pku.sei.modeler.model.uml.Kernel.UMLElement;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;

/**
 * @generated
 *
 */
public class ExceptionHandler extends UMLElement implements IExceptionHandler {
	// attributes
	
	
	
	
	// references
	
	protected MetaTypedList handlerBody;
	
	protected MetaTypedList exceptionInput;
	
	protected MetaTypedList exceptionType;
	
	
	
	// getters & setters for attributes
	
	// getters for references
	
	public MetaTypedList getHandlerBody() {
		if(handlerBody == null) {
			handlerBody = new MetaTypedList(ExecutableNode.class, this, ModelPackage.EXCEPTIONHANDLER_HANDLERBODY);
		}
		return handlerBody;
	}
	
	public MetaTypedList getExceptionInput() {
		if(exceptionInput == null) {
			exceptionInput = new MetaTypedList(ObjectNode.class, this, ModelPackage.EXCEPTIONHANDLER_EXCEPTIONINPUT);
		}
		return exceptionInput;
	}
	
	public MetaTypedList getExceptionType() {
		if(exceptionType == null) {
			exceptionType = new MetaTypedList(Classifier.class, this, ModelPackage.EXCEPTIONHANDLER_EXCEPTIONTYPE);
		}
		return exceptionType;
	}
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		// references
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.EXCEPTIONHANDLER_HANDLERBODY, handlerBody);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.EXCEPTIONHANDLER_EXCEPTIONINPUT, exceptionInput);		
		
		XMLUtility.xmlInstance.serializeNodesNotContain(root, ModelPackage.EXCEPTIONHANDLER_EXCEPTIONTYPE, exceptionType);		
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		// references
		
		this.getHandlerBody().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.EXCEPTIONHANDLER_HANDLERBODY, this));
		
		this.getExceptionInput().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.EXCEPTIONHANDLER_EXCEPTIONINPUT, this));
		
		this.getExceptionType().addAll(XMLUtility.xmlInstance.deSerializeNodesNotContain(root, ModelPackage.EXCEPTIONHANDLER_EXCEPTIONTYPE, this));
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		// references
		
		else if(ModelPackage.EXCEPTIONHANDLER_HANDLERBODY.equals(featureID)) {
			getHandlerBody().add(value);
		}
		
		else if(ModelPackage.EXCEPTIONHANDLER_EXCEPTIONINPUT.equals(featureID)) {
			getExceptionInput().add(value);
		}
		
		else if(ModelPackage.EXCEPTIONHANDLER_EXCEPTIONTYPE.equals(featureID)) {
			getExceptionType().add(value);
		}
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 